package main

import (
	"fmt"
	"time"
)

func main() {
	//定时器1
	fmt.Println("系统现在时间：", time.Now())
	timer := time.NewTimer(2 * time.Second)
	nowTime := <-timer.C //系统将当前时间写进channel，本地读出来
	fmt.Println("经过定时器1后当下时间：", nowTime)

	//定时器2
	nowTime = <-time.After(2 * time.Second)
	fmt.Println("经过定时器2后当下时间：", nowTime)

	//定时器3
	time.Sleep(2 * time.Second)
	fmt.Println("经过定时器3后当下时间：", time.Now())

}
